﻿/*
 * Copyright © 2020, Wuxi Safover Intelligent Technology Co., Ltd. All rights reserved.
 * 
 * 无锡安永智能科技有限公司版权所有，未经许可，不得用于商业用途
 * 
 * Visit: https://www.safover.com/ 
 */

using Safover.LidarCollector.Models;

namespace Safover.LidarCollector.Core
{
    internal abstract class BaseGpsLocatorController : BaseDeviceController, IGpsLocatorControllable
    {
        public abstract GpsLocatorStatus GpsLocatorStatus { get; }

        public virtual bool CanOpen => false;

        public virtual bool CanClose => false;

        public virtual bool CanOperate => false;

        protected GpsLocatorDevice Device { get; }

        public BaseGpsLocatorController(GpsLocatorDevice device)
        {
            Device = device;
        }

        public virtual bool TryClose()
        {
            HandleInvalidOperation();
            return false;
        }

        public virtual GpsInformation TryObtainGpsInformation()
        {
            HandleInvalidOperation();
            return default;
        }

        public virtual bool TryOpen()
        {
            HandleInvalidOperation();
            return false;
        }

        protected void SetStatus(GpsLocatorStatus status)
        {
            Device.SetStatus(status);
        }
    }

}
